package com.acwing.partition21;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/5/10 9:20
 */
public class AC2031折叠绳子 {

    private static final int N = 110, M = 10010;
    private static int[] p = new int[N];
    private static int n, m;

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = nextInt(); m = nextInt();
        for (int i = 0; i < n; i++) p[i] = nextInt();
        Arrays.sort(p, 0, n);
        int ans = 0;
        //枚举每个绳结
        for (int i = 1; i < n - 1; i++) {
            if (check(i, i)) ans++;
        }
        //枚举每两个绳结的中点
        for (int i = 1; i < n; i++) {
            if (check(i - 1, i)) ans++;
        }
        writer.println(ans);
        writer.flush();
    }

    private static boolean check(int l, int r) {
        for (int i = l, j = r; i >= 0 && j < n; i--, j++) {
            if (p[l] - p[i] != p[j] - p[r]) return false;
        }
        return true;
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
